package com.shdaily.android;

import java.net.URL;
import java.util.Date;
import java.util.ArrayList;
import java.text.ParseException;

class Article {
	public int id;
	public String title;
	public String summary;
	public String author;
	public int hasPic;
	public boolean hasHD;
	public String date;
	public String timeAgo;
	public String categoryName;
	public ArrayList<Image> imageList;
	public String body;
	
	public Article()
	{
		this.id = 0;
		this.title = "";
		this.summary = "";
		this.hasPic = 0;
		this.hasHD = false;
		this.date = "";
		this.timeAgo = "";
		this.categoryName = "";
		this.imageList = new ArrayList<Image>();
		this.body = "";
	}
	
	public Article (int id, String title, String summary, 
			String date, String timeAgo, String categoryName, ArrayList<Image> imageList, int hasPic, boolean hasHD)
	{
		this.id = id;
		this.title = title;
		this.summary = summary;
		this.hasPic = hasPic;
		this.hasHD = hasHD;
		this.date = date;
		this.timeAgo = timeAgo;
		this.categoryName = categoryName;
		this.imageList = imageList;
		this.body= "";
	}
	
	public Article (int id, String title, String summary, 
			String date, String timeAgo, String categoryName, int hasPic, boolean hasHD)
	{
		this.id = id;
		this.title = title;
		this.summary = summary;
		this.hasPic = hasPic;
		this.hasHD = hasHD;
		this.date = date;
		this.timeAgo = timeAgo;
		this.categoryName = categoryName;
		this.imageList = new ArrayList<Image>();
		this.body= "";
	}
	
	public Article (int id, String title, String summary, String author,
			int hasPic, boolean hasHD, String date, String timeAgo, String categoryName, ArrayList<Image> imageList, String body)
	{
		this.id = id;
		this.title = title;
		this.summary = summary;
		this.author = author;
		this.hasPic = hasPic;
		this.hasHD = hasHD;
		this.date = date;
		this.timeAgo = timeAgo;
		this.categoryName = categoryName;
		this.imageList = imageList;
		this.body= body;
	}

	public String getDate() {
        return date;
    }

    public void setDate(String dateString) {
        date = dateString;
    }

	public int getId() {
		return id;
	}

	public void setId(int id) {
		this.id = id;
	}

	public String getTitle() {
		return title;
	}

	public void setTitle(String title) {
		this.title = title;
	}

	public String getSummary() {
		return summary;
	}

	public void setSummary(String summary) {
		this.summary = summary;
	}

	public int getHasPic() {
		return hasPic;
	}

	public void setHasPic(int hasPic) {
		this.hasPic = hasPic;
	}

	public boolean getHasHD() {
		return hasHD;
	}

	public void setHasHD(boolean hasHD) {
		this.hasHD = hasHD;
	}

	public String getTimeAgo() {
		return timeAgo;
	}

	public void setTimeAgo(String timeAgo) {
		this.timeAgo = timeAgo;
	}

	public String getCategoryName() {
		return categoryName;
	}

	public void setCategoryName(String categoryName) {
		this.categoryName = categoryName;
	}

	public ArrayList<Image> getImageList() {
		return imageList;
	}

	public void setImageList(ArrayList<Image> imageList) {
		this.imageList = imageList;
	}
    
	public String getBody() {
		return body;
	}

	public void setBody(String body) {
		this.body = body;
	}

	public String getAuthor() {
		return author;
	}

	public void setAuthor(String author) {
		this.author = author;
	}
	
	public Image findThumbnail() {
		int length = this.imageList.size();
		if (length != 0) {
			for (int i=0; i<length; i++) {
				if (imageList.get(i).getSize().equals("small"))
				{
					return imageList.get(i);
				}
			}
			return imageList.get(0);
		}
		else return null;
	}

    
}

